package com.usefullc.blog.enums;


import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * 文章来源
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum ArticleSourceEnum {


    inside(0, "本站"),

    ZHIHU(1, "知乎"),

    CSDN(2, "CSDN"),

    JUEJIN(3, "掘金"),

    JIANSHU(5, "简书"),


    ;


    private int code;
    private String value;

    ArticleSourceEnum(int code, String value) {
        this.code = code;
        this.value = value;
    }


    public static ArticleSourceEnum getByCode(int code) {

        for (ArticleSourceEnum s : ArticleSourceEnum.values()) {
            if (s.getCode() == code) {
                return s;
            }
        }
        return null;
    }


    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getValue() {


        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

}
